package com.lzq.springblog.exception;

import com.lzq.springblog.common.Result;

/**
 * 自定义异常
 */
public class ApplicationException extends RuntimeException{

    //在异常中持有异常信息
    protected Result errorResult;

    /**
     * 构造方法
     * @param errorResult
     */
    public ApplicationException (Result errorResult) {
        super(errorResult.getMessage());
        this.errorResult = errorResult;
    }

    public Result getErrorResult() {
        return errorResult;
    }

    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }

    public ApplicationException() {
        super();
    }
}
